package com.qtcm.nas.fyx.bendianhuiyuan.web;

import com.qtcm.nas.fyx.bendianhuiyuan.service.IBendhyService;
import com.qtcm.nas.fyx.huiyuantianjia.pojo.MemberShip;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;

@Controller("bendhyController")
@RequestMapping("bendhycx")
public class BendhyController {
    @Autowired
    @Qualifier("bendhyService")
    private IBendhyService bendhyService;

    @RequestMapping("findAll")
    public String findAll(Model model){
        List<MemberShip> all = bendhyService.findAll();
        for (MemberShip memberShip:all) {
            int lovecar = bendhyService.lovecar(memberShip.getC_membernumber());
            memberShip.setLovecar(lovecar);
            int bigcount = bendhyService.bigcount(memberShip.getC_membernumber());
            memberShip.setBigcount(bigcount);
            int dingdcs = bendhyService.dingdcs(memberShip.getC_membernumber());
            memberShip.setDingdcs(dingdcs);
            int chuzhi = bendhyService.chuzhi(memberShip.getC_membernumber());
            memberShip.setC_chuzhi(chuzhi);
            int nianka = bendhyService.nianka(memberShip.getC_membernumber());
            memberShip.setC_nianka(nianka);
            int findddid = bendhyService.findddid(memberShip.getC_membernumber());
            memberShip.setD_Comment_number(findddid);
        }
        model.addAttribute("list",all);
        for (MemberShip m:all){
            System.out.println(m);
        }
        return "user_List";
    }
}
